package com.wjj.dao.repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wjj.dao.po.ClassPO;
import com.wjj.dao.repository.mapper.ClassCrudMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @Description
 * @Author junjun Wang
 * @Date Create in 20:07 2023/12/7
 **/
@Repository
public class ClassRepositoryImpl extends ServiceImpl<ClassCrudMapper, ClassPO> implements
		ClassRepository {

	@Autowired
	private ClassCrudMapper classCrudMapper;

	@Override
	public List<ClassPO> getClasses() {
		return classCrudMapper.selectList(new QueryWrapper<>());
	}

	@Override
	public ClassPO getClassById(Integer classId) {
		return classCrudMapper.selectById(classId);
	}

	@Override
	public Boolean addClass(List<ClassPO> classes) {
		return this.saveBatch(classes);
	}

	@Override
	public Integer updateClass(ClassPO classPO) {
		return classCrudMapper.updateById(classPO);
	}

	@Override
	public Integer deleteClassById(Integer classId) {
		return classCrudMapper.deleteById(classId);
	}
}
